package com.smartplatform.dto;

import com.smartplatform.pojo.CheckNull;
import com.smartplatform.pojo.CheckType;
import lombok.Data;
import lombok.ToString;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

/**
 * @Author 咕唧
 * @Date 2022/5/30 21:40
 * @Version 1.0
 */
@Data
@ToString
public class DeviceDto implements CheckNull {
    private String deviceId;
    private String deviceName;
    private Long categyId;

    @Override
    public boolean isEmpty(CheckType type) {
        if (type.equals(CheckType.ADD)) {
            return !StringUtils.hasText(deviceId)
                    || !StringUtils.hasText(deviceName)
                    || ObjectUtils.isEmpty(categyId) && categyId <= 0;
        }
        return false;
    }
}
